package edu.hrbeu.crc.controller;


import edu.hrbeu.crc.pojo.dto.ConsumptionDTO;
import edu.hrbeu.crc.pojo.dto.MonthConsumptionDTO;
import edu.hrbeu.crc.pojo.result.Result;
import edu.hrbeu.crc.pojo.vo.ConsumptionVO;
import edu.hrbeu.crc.pojo.vo.MonthlyTrendVO;
import edu.hrbeu.crc.service.BillService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/statistics")
public class StatisticsController {

    private final BillService billService;

    /**
     * 获取消费占比图
     * @param consumptionDTO
     * @return
     */
    @GetMapping("/category")
    public Result getConsumptionProportion(ConsumptionDTO consumptionDTO) {
        ConsumptionVO vo = billService.getConsumptionProportion(consumptionDTO);
        return Result.success(vo);
    }


    @GetMapping("/monthlyTrend")
    public Result getMonthlyConsumptionTrend(MonthConsumptionDTO monthConsumptionDTO) {
        MonthlyTrendVO vo = billService.getMonthlyConsumptionTrend(monthConsumptionDTO);
        return Result.success(vo);
    }
}
